package com.liruo.springframework.core.aop.Introduction;

import org.springframework.aop.Advisor;
import org.springframework.aop.ClassFilter;
import org.springframework.aop.support.DefaultIntroductionAdvisor;
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
import org.springframework.aop.support.RootClassFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class IntroductionSpringConfiguration {
  @Bean
  public Advisor myIntroductionAdvisor(){
    DelegatingIntroductionInterceptor interceptor = new DelegatingIntroductionInterceptor(new DefaultIntroductionImpl());
    final ClassFilter classFilter = new RootClassFilter(IntroductionSpringTarget.class);
    return new DefaultIntroductionAdvisor(interceptor, interceptor){
      @Override
      public ClassFilter getClassFilter() {
        return classFilter;
      }
    };
  }
}
